<?php
/**
 * @author: Shauan Andrade < shauan@unimedteresina.com >
 * @copyright 2014 - 2014 PhpStorm
 * Date and time 14/10/14 - 17:17
 */

namespace helpers;

use core\App;
use PHPMailer;

App::uses('class.phpmailer','vendor/phpmailer');

class EmailHelper extends PHPMailer{

    public $from_name = "Tecnologia da Informa��o";

    public function __construct(){
        parent::__construct();
        $this->IsSMTP();
        $this->Host = "10.1.6.19";
        $this->From = "ti@unimedteresina.com.br";
        $this->FromName = $this->from_name;
        $this->IsHTML(true);
    }

    public function to($address, $name = ''){
        parent::AddAddress($address, $name);
    }

    public function cc($address, $name = ''){
        parent::AddCC($address, $name);
    }

    public function bcc($address, $name = ''){
        parent::AddBCC($address, $name);
    }

    public function message($texto){
        $this->message = $texto;
    }

    public function subject($text){
        $this->subject = $text;
    }

    public function Send(){
        $this->Subject = $this->subject;
        $this->Body = $this->message;
        return parent::Send();
    }

    public function ClearAllRecipients(){
        parent::ClearAllRecipients();
    }
} 